﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DesignPattern.IteratorPattern
{
    class Program
    {
        static void Main(string[] args)
        {
            ConcreteAggregate a = new ConcreteAggregate();
            a[0] = "鸭子";
            a[1] = "小鸡";
            a[2] = "麻雀";
            Iterator it = new ConcreteIterator(a);
            object item = it.First();
            while (!it.IsDone())
            {
                Console.WriteLine("{0}请买票!",it.CurrentItem());
                it.Next();
            }
            Console.Read();

        }
    }
}
